package org.realman.sprites{
	import flash.display.Graphics;
	import flash.display.Sprite;
	
	public class Monster extends Sprite{
		
		private var _vx:Number;
		
		public function get vx():Number{
			return _vx;
		}
		
		public function set vx(value:Number):void{
			_vx = value;
		}
		
		private var _vy:Number;
		
		public function get vy():Number{
			return _vy;
		}
		
		public function set vy(value:Number):void{
			_vy = value;
		}
		
		private var _speed:Number;

		public function get speed():Number{
			return _speed;
		}

		public function set speed(value:Number):void{
			_speed = value;
			
			_vx = Math.cos(angle) * _speed;
			_vy = Math.sin(angle) * _speed;
		}
		
		private var _angle:Number;

		public function get angle():Number{
			return _angle;
		}

		public function set angle(value:Number):void{
			_angle = value;
			
			_vx = Math.cos(angle) * _speed;
			_vy = Math.sin(angle) * _speed;
		}
		
		public var size:Number = 5;
		
		public function Monster(speed:Number = 8, angle:Number = 0, size:Number = 5){
			super();
			this.size = size;
			this.angle = angle;
			this.speed = speed;
			init();
		}
		
		private function init():void{
			var g:Graphics = this.graphics;
			g.moveTo(-size/2, -size/2);
			g.beginFill(0xFF00FF);
			g.drawRect(-size/2, -size/2, size, size);
			g.endFill();
		}
		
		public function move():void{
			x += vx;
			y += vy;
		}
		
		public function stop():void{
			vx = 0;
			vy = 0;
		}
	}
}